package qldc.pm.tiensu.model.impl;

import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;

import qldc.pm.tiensu.model.PhieuThongTinVeNguoiCoTienSu;

import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

import java.util.Date;

/**
 * The cache model class for representing PhieuThongTinVeNguoiCoTienSu in entity cache.
 *
 * @author Brian Wing Shun Chan
 * @see PhieuThongTinVeNguoiCoTienSu
 * @generated
 */
public class PhieuThongTinVeNguoiCoTienSuCacheModel implements CacheModel<PhieuThongTinVeNguoiCoTienSu>,
    Externalizable {
    public long phieuThongTinVeNguoiCoTienSuId;
    public long userId;
    public String userName;
    public long createDate;
    public long modifiedDate;
    public long tienSuId;
    public String maSoHoSoTienSuTuToaAn;
    public String nguoiTrichLuc;
    public String thamPhan;
    public String soDinhDanhCaNhan;
    public String chuThich;
    public String noiTamTruDiaChi;
    public long noiTamTruTinhId;
    public long noiTamTruQuanHuyenId;
    public long noiTamTruPhuongXaId;
    public String noiThuongTruDiaChi;
    public long noiThuongTruTinhId;
    public long noiThuongTruQuanHuyenId;
    public long noiThuongTruPhuongXaId;
    public String hoTenVoHoacChong;
    public String hoTenCha;
    public String hoTenMe;

    @Override
    public String toString() {
        StringBundler sb = new StringBundler(45);

        sb.append("{phieuThongTinVeNguoiCoTienSuId=");
        sb.append(phieuThongTinVeNguoiCoTienSuId);
        sb.append(", userId=");
        sb.append(userId);
        sb.append(", userName=");
        sb.append(userName);
        sb.append(", createDate=");
        sb.append(createDate);
        sb.append(", modifiedDate=");
        sb.append(modifiedDate);
        sb.append(", tienSuId=");
        sb.append(tienSuId);
        sb.append(", maSoHoSoTienSuTuToaAn=");
        sb.append(maSoHoSoTienSuTuToaAn);
        sb.append(", nguoiTrichLuc=");
        sb.append(nguoiTrichLuc);
        sb.append(", thamPhan=");
        sb.append(thamPhan);
        sb.append(", soDinhDanhCaNhan=");
        sb.append(soDinhDanhCaNhan);
        sb.append(", chuThich=");
        sb.append(chuThich);
        sb.append(", noiTamTruDiaChi=");
        sb.append(noiTamTruDiaChi);
        sb.append(", noiTamTruTinhId=");
        sb.append(noiTamTruTinhId);
        sb.append(", noiTamTruQuanHuyenId=");
        sb.append(noiTamTruQuanHuyenId);
        sb.append(", noiTamTruPhuongXaId=");
        sb.append(noiTamTruPhuongXaId);
        sb.append(", noiThuongTruDiaChi=");
        sb.append(noiThuongTruDiaChi);
        sb.append(", noiThuongTruTinhId=");
        sb.append(noiThuongTruTinhId);
        sb.append(", noiThuongTruQuanHuyenId=");
        sb.append(noiThuongTruQuanHuyenId);
        sb.append(", noiThuongTruPhuongXaId=");
        sb.append(noiThuongTruPhuongXaId);
        sb.append(", hoTenVoHoacChong=");
        sb.append(hoTenVoHoacChong);
        sb.append(", hoTenCha=");
        sb.append(hoTenCha);
        sb.append(", hoTenMe=");
        sb.append(hoTenMe);
        sb.append("}");

        return sb.toString();
    }

    @Override
    public PhieuThongTinVeNguoiCoTienSu toEntityModel() {
        PhieuThongTinVeNguoiCoTienSuImpl phieuThongTinVeNguoiCoTienSuImpl = new PhieuThongTinVeNguoiCoTienSuImpl();

        phieuThongTinVeNguoiCoTienSuImpl.setPhieuThongTinVeNguoiCoTienSuId(phieuThongTinVeNguoiCoTienSuId);
        phieuThongTinVeNguoiCoTienSuImpl.setUserId(userId);

        if (userName == null) {
            phieuThongTinVeNguoiCoTienSuImpl.setUserName(StringPool.BLANK);
        } else {
            phieuThongTinVeNguoiCoTienSuImpl.setUserName(userName);
        }

        if (createDate == Long.MIN_VALUE) {
            phieuThongTinVeNguoiCoTienSuImpl.setCreateDate(null);
        } else {
            phieuThongTinVeNguoiCoTienSuImpl.setCreateDate(new Date(createDate));
        }

        if (modifiedDate == Long.MIN_VALUE) {
            phieuThongTinVeNguoiCoTienSuImpl.setModifiedDate(null);
        } else {
            phieuThongTinVeNguoiCoTienSuImpl.setModifiedDate(new Date(
                    modifiedDate));
        }

        phieuThongTinVeNguoiCoTienSuImpl.setTienSuId(tienSuId);

        if (maSoHoSoTienSuTuToaAn == null) {
            phieuThongTinVeNguoiCoTienSuImpl.setMaSoHoSoTienSuTuToaAn(StringPool.BLANK);
        } else {
            phieuThongTinVeNguoiCoTienSuImpl.setMaSoHoSoTienSuTuToaAn(maSoHoSoTienSuTuToaAn);
        }

        if (nguoiTrichLuc == null) {
            phieuThongTinVeNguoiCoTienSuImpl.setNguoiTrichLuc(StringPool.BLANK);
        } else {
            phieuThongTinVeNguoiCoTienSuImpl.setNguoiTrichLuc(nguoiTrichLuc);
        }

        if (thamPhan == null) {
            phieuThongTinVeNguoiCoTienSuImpl.setThamPhan(StringPool.BLANK);
        } else {
            phieuThongTinVeNguoiCoTienSuImpl.setThamPhan(thamPhan);
        }

        if (soDinhDanhCaNhan == null) {
            phieuThongTinVeNguoiCoTienSuImpl.setSoDinhDanhCaNhan(StringPool.BLANK);
        } else {
            phieuThongTinVeNguoiCoTienSuImpl.setSoDinhDanhCaNhan(soDinhDanhCaNhan);
        }

        if (chuThich == null) {
            phieuThongTinVeNguoiCoTienSuImpl.setChuThich(StringPool.BLANK);
        } else {
            phieuThongTinVeNguoiCoTienSuImpl.setChuThich(chuThich);
        }

        if (noiTamTruDiaChi == null) {
            phieuThongTinVeNguoiCoTienSuImpl.setNoiTamTruDiaChi(StringPool.BLANK);
        } else {
            phieuThongTinVeNguoiCoTienSuImpl.setNoiTamTruDiaChi(noiTamTruDiaChi);
        }

        phieuThongTinVeNguoiCoTienSuImpl.setNoiTamTruTinhId(noiTamTruTinhId);
        phieuThongTinVeNguoiCoTienSuImpl.setNoiTamTruQuanHuyenId(noiTamTruQuanHuyenId);
        phieuThongTinVeNguoiCoTienSuImpl.setNoiTamTruPhuongXaId(noiTamTruPhuongXaId);

        if (noiThuongTruDiaChi == null) {
            phieuThongTinVeNguoiCoTienSuImpl.setNoiThuongTruDiaChi(StringPool.BLANK);
        } else {
            phieuThongTinVeNguoiCoTienSuImpl.setNoiThuongTruDiaChi(noiThuongTruDiaChi);
        }

        phieuThongTinVeNguoiCoTienSuImpl.setNoiThuongTruTinhId(noiThuongTruTinhId);
        phieuThongTinVeNguoiCoTienSuImpl.setNoiThuongTruQuanHuyenId(noiThuongTruQuanHuyenId);
        phieuThongTinVeNguoiCoTienSuImpl.setNoiThuongTruPhuongXaId(noiThuongTruPhuongXaId);

        if (hoTenVoHoacChong == null) {
            phieuThongTinVeNguoiCoTienSuImpl.setHoTenVoHoacChong(StringPool.BLANK);
        } else {
            phieuThongTinVeNguoiCoTienSuImpl.setHoTenVoHoacChong(hoTenVoHoacChong);
        }

        if (hoTenCha == null) {
            phieuThongTinVeNguoiCoTienSuImpl.setHoTenCha(StringPool.BLANK);
        } else {
            phieuThongTinVeNguoiCoTienSuImpl.setHoTenCha(hoTenCha);
        }

        if (hoTenMe == null) {
            phieuThongTinVeNguoiCoTienSuImpl.setHoTenMe(StringPool.BLANK);
        } else {
            phieuThongTinVeNguoiCoTienSuImpl.setHoTenMe(hoTenMe);
        }

        phieuThongTinVeNguoiCoTienSuImpl.resetOriginalValues();

        return phieuThongTinVeNguoiCoTienSuImpl;
    }

    @Override
    public void readExternal(ObjectInput objectInput) throws IOException {
        phieuThongTinVeNguoiCoTienSuId = objectInput.readLong();
        userId = objectInput.readLong();
        userName = objectInput.readUTF();
        createDate = objectInput.readLong();
        modifiedDate = objectInput.readLong();
        tienSuId = objectInput.readLong();
        maSoHoSoTienSuTuToaAn = objectInput.readUTF();
        nguoiTrichLuc = objectInput.readUTF();
        thamPhan = objectInput.readUTF();
        soDinhDanhCaNhan = objectInput.readUTF();
        chuThich = objectInput.readUTF();
        noiTamTruDiaChi = objectInput.readUTF();
        noiTamTruTinhId = objectInput.readLong();
        noiTamTruQuanHuyenId = objectInput.readLong();
        noiTamTruPhuongXaId = objectInput.readLong();
        noiThuongTruDiaChi = objectInput.readUTF();
        noiThuongTruTinhId = objectInput.readLong();
        noiThuongTruQuanHuyenId = objectInput.readLong();
        noiThuongTruPhuongXaId = objectInput.readLong();
        hoTenVoHoacChong = objectInput.readUTF();
        hoTenCha = objectInput.readUTF();
        hoTenMe = objectInput.readUTF();
    }

    @Override
    public void writeExternal(ObjectOutput objectOutput)
        throws IOException {
        objectOutput.writeLong(phieuThongTinVeNguoiCoTienSuId);
        objectOutput.writeLong(userId);

        if (userName == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(userName);
        }

        objectOutput.writeLong(createDate);
        objectOutput.writeLong(modifiedDate);
        objectOutput.writeLong(tienSuId);

        if (maSoHoSoTienSuTuToaAn == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(maSoHoSoTienSuTuToaAn);
        }

        if (nguoiTrichLuc == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(nguoiTrichLuc);
        }

        if (thamPhan == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(thamPhan);
        }

        if (soDinhDanhCaNhan == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(soDinhDanhCaNhan);
        }

        if (chuThich == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(chuThich);
        }

        if (noiTamTruDiaChi == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(noiTamTruDiaChi);
        }

        objectOutput.writeLong(noiTamTruTinhId);
        objectOutput.writeLong(noiTamTruQuanHuyenId);
        objectOutput.writeLong(noiTamTruPhuongXaId);

        if (noiThuongTruDiaChi == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(noiThuongTruDiaChi);
        }

        objectOutput.writeLong(noiThuongTruTinhId);
        objectOutput.writeLong(noiThuongTruQuanHuyenId);
        objectOutput.writeLong(noiThuongTruPhuongXaId);

        if (hoTenVoHoacChong == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(hoTenVoHoacChong);
        }

        if (hoTenCha == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(hoTenCha);
        }

        if (hoTenMe == null) {
            objectOutput.writeUTF(StringPool.BLANK);
        } else {
            objectOutput.writeUTF(hoTenMe);
        }
    }
}
